from typing import *


class Solution:

    def vowelStrings(self, words: List[str],
                     queries: List[List[int]]) -> List[int]:
        s = tuple("aeiou")
        sums = [0] * (len(words) + 1)
        for i, v in enumerate(words):
            sums[i + 1] = sums[i] + 1 if v[0] in s and v[-1] in s else sums[i]

        ans = []
        for l, r in queries:
            ans.append(sums[r + 1] - sums[l])
        return ans
